<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function countDown(theTime) {
        var now = new Date().getTime()
        var ftime = new Date(theTime).getTime()
        var count = (ftime - now) / 1000
        var d = parseInt(count / 60 / 60 / 24)
          .toString()
          .padStart(2, '0')
        var h = parseInt((count / 60 / 60) % 24)
          .toString()
          .padStart(2, '0')
        var m = parseInt((count / 60) % 60)
          .toString()
          .padStart(2, '0')
        var s = parseInt(count % 60)
          .toString()
          .padStart(2, '0')
        var str = `还有 ${d}天 ${h}时 ${m}分${s}秒 见面`
        return str
      }
      document.write(countDown('2020-10-1'))
    </script>
  </body>
</html>
